﻿using System.IO;
using System.Threading.Tasks;
using MasterDetailTemplate.Services;
using MasterDetailTemplate.Services.Implementations;
using MasterDetailTemplate.UnitTest.Services;
using Moq;

namespace MasterDetailTemplate.UnitTest.Helpers
{
    /// <summary>
    /// 事件存储帮助类。
    /// By FJH
    /// </summary>
    public static class EventStorageHelper
    {
        /// <summary>
        /// 数据库中事件总数量。
        /// </summary>
        public const int NumberEvent = 2;

        /// <summary>
        /// 删除数据库文件。
        /// </summary>
        public static void RemoveDatabaseFile()
        {
            //if (EventStorage.EventDbPath!=null)
            //{
                File.Delete(EventStorage.EventDbPath);
            //}
        }

        /// <summary>
        /// 获得已初始化的事件存储。
        /// </summary>
        public static async Task<EventStorage> GetInitializedEventStorage()
        {
            var eventStorage =
                new EventStorage(new Mock<IPreferenceStorage>().Object);
            await eventStorage.InitializeAsync();
            return eventStorage;
        }


    }
}
